<template>
	<view class="content">
		<u-navbar leftIcon=" " title="首页"></u-navbar>
		<!-- 轮播图 -->
		<u-swiper
			:list="banners"
			indicator
			indicatorMode="dot"
			circular
			imgMode="heightFix"
			height="170"
		></u-swiper>
		<!-- 快捷入口 -->
		<view class="home-enter" style="border-bottom: 20rpx solid #f6f4f8;">
			<view class="item" v-for="(item,index) in enters" :key="index" @click="jumpPage(item.url)">
				<image class="img" :src="`https://zznc.ahyzg.com/image/home-icon0${index+1}.png`" mode="widthFix"></image>
				<view>{{item.name}}</view>
			</view>
		</view>
		<!-- 发布需求 -->
		<view class="flex-row space-x-40 section" style="border-bottom: 20rpx solid #f6f4f8;">
		  <view class="flex-col space-y-16 group">
		    <view class="flex-row space-x-19">
		      <image
		        class="image"
		        src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/632afc43e391320011695f3b/16639082149037409883.png"
		      />
		      <text class="text">发布需求</text>
		    </view>
		    <view class="group_2">
		      <text class="font_1">买专利、卖专利、查专利、管理专利等</text>
		      <text class="font_1">可在这里发布您的需求~~~</text>
		    </view>
		  </view>
		  <view @click="jumpPage('homeCommonPage','demand')" class="flex-col items-center text-wrapper"><text class="text_2">我要发布需求</text></view>
		</view>
		<!-- 上新专利 -->
		<view class="home-new home-padding">
			<view class="flex justent">
				<view class="flex new-head-1">
					<i class="iconfont icon-new"></i>
					<text class="head-1">上新专利</text>
					<text class="head-2">每日大数据精选 优质专利</text>
				</view>
				<view class="more flex" @click="jumpPage('newPatent')">
					<text>更多</text>
					<i class="iconfont icon-jiantou-you"></i>
				</view>
			</view>
			
			<view class="new-content">
				<view class="item" v-for="(item,index) in newPatents" :key="index">
					<view class="flex aitem-center">
						<image class="image" :src="`https://zznc.ahyzg.com/image/label${item.patentType}.png`" mode="widthFix"></image>
						<view class="left-1" @click="jumpPage('newdetails',item.patentNo)">{{item.patentName || '-'}}</view>
					</view>
					<view class="flex justent aitem-center">
						<view class="item-left">
							<view class="left-2">
								专利号: 
								<text>{{item.patentNo || '-'}}</text>
							</view>
							<view class="flex left-3">
								<text class="left-3-1">价格：</text>
								<text>{{item.unitPrice}}元</text>
								<text class="left-3-2">起</text>
								<text>可议价</text>
							</view>
						</view>
						<view class="item-right">
							<u-button type="text" color="#5677fc" @click="jumpPage('homeCommonPage','link')">立即联系</u-button>
						</view>
					</view>
				</view>
			</view>
			<view class="change flex justent-center" @click="getNewPatentFun('change')">
				<i class="iconfont icon-huanyihuan"></i>
				<view>
					换一换
				</view>
			</view>
		</view>
		<!-- 推荐服务 -->
		<view class="flex-col section_2">
		  <view class="flex-row space-x-7 group_3">
		    <image
		      class="image_2"
		      src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/632afc43e391320011695f3b/16639082141212858417.png"
		    />
		    <text class="text_3">推荐服务</text>
		  </view>
		  <view class="flex-col space-y-20 list-item">
		    <text class="font_2 text_4">专利交易</text>
		    <view>
		      <text class="font_3">专利以有偿的方式在不同的经济主体间的转移，其中，</text>
		      <text class="font_3">买方取得专利使用权或所有权，卖方获得超额经济...</text>
		    </view>
		    <view class="flex-row space-x-34 group_4">
		      <view @click="jumpPage('patentCommonPage',recommends[0])" class="flex-col items-center text-wrapper_2"><text class="font_4">了解详情</text></view>
		      <view @click="phone" class="flex-row justify-center section_3">
		        <image
		          class="image_3"
		          src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/632afc43e391320011695f3b/16639082147174231857.png"
		        />
		        <text class="font_5 text_5">15755387045</text>
		      </view>
		    </view>
		  </view>
		  <view class="flex-col space-y-20 list-item_2">
		    <text class="font_2 text_6">专利代理</text>
		    <view>
		      <text class="font_3">指在申请专利、进行专利许可证贸易或者解决专利纠纷</text>
		      <text class="font_3">的过程中，专利申请人(或者专利权人）委派具有专...</text>
		    </view>
		    <view class="flex-row space-x-34 group_4">
		      <view @click="jumpPage('patentCommonPage',recommends[1])" class="flex-col items-center text-wrapper_2"><text class="font_4">了解详情</text></view>
		      <view @click="phone" class="flex-row justify-center section_3">
		        <image
		          class="image_3"
		          src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/632afc43e391320011695f3b/16639082147174231857.png"
		        />
		        <text class="font_5 text_5">15755387045</text>
		      </view>
		    </view>
		  </view>
		  <view class="flex-col space-y-20 list-item_3">
		    <text class="font_2 text_7">专利答复</text>
		    <view>
		      <text class="font_3">专利申请人收到国知局驳回决定后若对驳回决定不服，</text>
		      <text class="font_3">可以在驳回决定收到之日起3个月内提复审，申请人...</text>
		    </view>
		    <view class="flex-row space-x-34 group_4">
		      <view @click="jumpPage('patentCommonPage',recommends[2])" class="flex-col items-center text-wrapper_2"><text class="font_4">了解详情</text></view>
		      <view @click="phone" class="flex-row justify-center section_3">
		        <image
		          class="image_3"
		          src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/632afc43e391320011695f3b/16639082147174231857.png"
		        />
		        <text class="font_5 text_5">15755387045</text>
		      </view>
		    </view>
		  </view>
		  <view class="flex-col space-y-21 list-item_4">
		    <text class="font_2 text_8">专利监管</text>
		    <view>
		      <text class="font_3">专利费用在专利权期限届满前终止。专利权人在其专利</text>
		      <text class="font_3">被授权之后，有缴纳专利年费的义务，年费的数额...</text>
		    </view>
		    <view class="flex-row space-x-34 group_4">
		      <view @click="jumpPage('patentCommonPage',recommends[3])" class="flex-col items-center text-wrapper_2"><text class="font_4">了解详情</text></view>
		      <view @click="phone" class="flex-row justify-center section_3">
		        <image
		          class="image_3"
		          src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/632afc43e391320011695f3b/16639082147174231857.png"
		        />
		        <text class="font_5 text_5">15755387045</text>
		      </view>
		    </view>
		  </view>
		</view>
		<u-notify message="正在建设..." ref="uNotify"></u-notify>
	</view>
</template>
<script>
	import {getNewPatent,getBanner} from '@/api/index.js';
	import login from '@/components/login2.vue';
	export default {
		components:{login},
		data() {
			return {
				newPatentIndex:1,
				banners: [
					'https://zznc.ahyzg.com/image/ERP-xiaochengxu-banner01.png',
					'https://zznc.ahyzg.com/image/ERP-xiaochengxu-banner02.png',
					'https://zznc.ahyzg.com/image/ERP-xiaochengxu-banner03.png',
					'https://zznc.ahyzg.com/image/ERP-xiaochengxu-banner04.png',
				],
				enters:[
					{name:'我的合同',url:'contract'},
					{name:'我的订单',url:'order'},
					{name:'专利监管',url:'supervise'},
					{name:'专利预警',url:'early'}
				],
				newPatents:[],
				recommends:[
					{
						title:'专利交易',
						des:`专利以有偿的方式在不同的经济主体间的转移，其中，
							买方取得专利使用权或所有权，卖方获得超额经济...`,
						type:'deal'
					},
					{
						title:'专利代理',
						des:`指在申请专利、进行专利许可证贸易或者解决专利纠纷
							的过程中，专利申请人(或者专利权人）委派具有专...`,
						type:'apply'
					},
					{
						title:'专利答复',
						des:`专利申请人收到国知局驳回决定后若对驳回决定不服，
							可以在驳回决定收到之日起3个月内提复审，申请人...`,
						type:'answer'
					},
					{
						title:'专利监管',
						des:`专利费用在专利权期限届满前终止。专利权人在其专利
							被授权之后，有缴纳专利年费的义务，年费的数额...`,
						type:'supervise'
					}
				], 
			}
		},
		// 分享小程序
		onShareAppMessage(res) {
			return {
				title: '专利代理、交易找易知谷',
				path: 'https://zznc.ahyzg.com/image/share.png'
			};
		},
		onShareTimeline(res){
			return {
				title: '专利代理、交易找易知谷',
				path: 'https://zznc.ahyzg.com/image/share.png'
			};
		},
		onLoad() {
		},
		created() {
			this.getNewPatentFun();
		},
		methods: {
			getNewPatentFun(type) {
				if(type) {
					this.newPatentIndex += 1;
				}
				getNewPatent({pageSize:3,pageNo:this.newPatentIndex}).then(res => {
					if(res.code === 200) {
						this.newPatents = res.data.list;
					}
				})
				
				// getBanner({pageSize:10,pageNo:1}).then(res => {
				// 	if(res.code === 200) {
				// 		if(res.data.list?.length) this.banners = res.data.list;
						
				// 	}
				// })
			},
			phone(){
				uni.makePhoneCall({
					phoneNumber: '15755387045' //仅为示例
				});
			},
			jumpPage(url,value) {
				if(value && typeof value == 'object') {
					value = JSON.stringify(value)
				}
				if(url == 'newPatent') {
					uni.navigateTo({
						url:`../index/${url}`
					})
					return
				}else if(url == 'early') {
					this.$refs.uNotify.show({
						top: 0,
						type: 'warning',
						color: '#fff',
						bgColor: '#f9ae3d',
						message: '正在建设...',
						duration: 1000 * 3,
						fontSize: 20,
						safeAreaInsetTop:true
					})
					return;
				}else if(url == 'newdetails') {
					uni.navigateTo({
						url:`../index/${url}?patentNo=${value}`
					})
					return
				}
				
				uni.navigateTo({
					url:`../${url}/${url}?info=${value}`
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
.home-enter {
	display: flex;
	// height: 187rpx;
	background-color: #ffffff;
	padding-top: 24rpx;
	padding-bottom: 36rpx;
	.item {
		width: 25%;
		text-align: center;
		font-size: 26rpx;
		color: $uni-color-middle;
	}
	.img{
		width: 92rpx;
		height: 92rpx;
	}
}

.home-padding {
	padding: 0 16rpx 0 24rpx;
	margin-top: 20rpx;
	border-bottom: 20rpx solid #f6f4f8;
	background-color: #ffffff;
}

.home-padding-1 {
	padding: 0 16rpx 0 24rpx;
	margin-top: 20rpx;
	background-color: #ffffff;
}

.home-demand {
	// height: 160rpx;
	padding-top: 27rpx;
	padding-bottom: 26rpx;
	display: flex;
	.demand-left {
		width: 60%;
		.left-1 {
			font-size: 32rpx;
			color: #5677fc;
			margin-left: 19rpx;
		}
		
		.left-2{
			color: $uni-color-middle;
			font-size: 24rpx;
			margin-top: 20rpx;
		}
	}
	.demand-right{
		width: 40%;
		display: flex;
		align-items: center;
		.u-button {
			margin-right: 10rpx;
			width: 230rpx;
			height: 80rpx;
			margin-top: -13rpx;
		}
	}
}

.home-new {
	padding-top: 30rpx;
	padding-bottom: 22rpx;
	.new-head-1 {
		color: $uni-color-top;
		i{
			font-size: 46rpx;
			margin-top: -10rpx;
			margin-right: 6rpx;
			color: #37c637;
		}
		.head-1 {
			font-size: 34rpx;
		}
		.head-2{
			font-size: 20rpx;
			color: $uni-color-middle;
			margin-top: 14rpx;
			margin-left: 10rpx;
		}
	}
	.more {
		color: #5677fc;
		font-size: 20rpx;
		margin-top: 10rpx;
		i{
			font-size: 20rpx;
		}
	}
	.new-content {
		// margin-top: 5rpx;
		.item {
			border-top: 2rpx solid #f1f1f1;
			padding-top: 35rpx;
			padding-bottom: 30rpx;
		}
		.left-1 {
			font-size: 30rpx;
			overflow: hidden !important;
			text-overflow: ellipsis !important;
			display: -webkit-box !important;
			-webkit-line-clamp: 1;//文字上限行
			-webkit-box-orient: vertical;
			color: $uni-color-top;
			margin-left: 20rpx;
		}
		.item-left {
			font-size: 26rpx;
			color: $uni-color-middle;
			.left-2{
				margin: 22rpx 0;
				uni-text {
					margin-left: 10rpx;
				}
			}
			
			.left-3 {
				color: #ff7607;
				.left-3-1 {
					color: $uni-color-middle;
				}
				.left-3-2 {
					font-size: 18rpx;
					margin-left: 6rpx;
					margin-right: 30rpx;
					margin-top: 10rpx;
				}
			}
		}
		
		.item-right {
			margin-right: 20rpx;
			.u-button {
				height: 60rpx;
				width: 180rpx;
			}
			
		}
		
	}
	.change {
		font-size: 26rpx;
		color: $uni-color-middle;
		i {
			margin-right: 10rpx;
		}
	}
	.image{
		width: 70rpx;
	}
}

.home-recommend {
	padding-top: 30rpx;
	padding-bottom: 50rpx;
	.recommend-head {
		padding-bottom: 20rpx;
		border-bottom: 2rpx solid #f1f1f1;
		font-size: 34rpx;
		.head-1 {
			margin-left: 7rpx;
			color: #555;
		}
		i{
			color:  #fc5555;
			font-size: 46rpx;
			margin-top: -10rpx;
		}
	}
	
	.item{
		margin-top: 20rpx;
		padding: 26rpx 40rpx 22rpx 20rpx;
		.item-1 {
			font-size: 38rpx;
			color: $uni-color-top;
		}
		
		.item-2 {
			margin: 30rpx 0;
			font-size: 28rpx;
			color: $uni-color-middle;
		}
		
		.item-3 {
			padding-bottom: 22rpx;
			.item-3-btn {
				width: 250rpx;
				height: 60rpx;
				margin-right: 10rpx;
				border-radius: 40rpx;
			}
			.button-color {
				color: #6180fc;
				// background: #fafafa;
				margin-right: 10rpx;
				border-radius: 40rpx;
			}
		}
	}
}

.page-login {
	padding: 25rpx;
	.login-1 {
		margin-bottom: 20rpx;
		image {
			height: 80px;
		}
	}
	.item-1-1 {
		margin-top: 10rpx;
	}
}


.section {
  padding: 27rpx 21rpx 21rpx;
  background-color: #ffffff;
}
.space-x-40 > view:not(:first-child),
.space-x-40 > text:not(:first-child),
.space-x-40 > image:not(:first-child) {
  margin-left: 40rpx;
}
.group {
  flex: 1 1 auto;
}
.space-y-16 > view:not(:first-child),
.space-y-16 > text:not(:first-child),
.space-y-16 > image:not(:first-child) {
  margin-top: 16rpx;
}
.space-x-19 > view:not(:first-child),
.space-x-19 > text:not(:first-child),
.space-x-19 > image:not(:first-child) {
  margin-left: 19rpx;
}
.image {
  width: 30rpx;
  height: 29rpx;
}
.text {
  color: #5677fc;
  font-size: 32rpx;
  font-family: Microsoft YaHei;
  line-height: 32rpx;
}
.group_2 {
  margin-left: 10rpx;
  line-height: 32rpx;
}
.font_1 {
  font-size: 24rpx;
  font-family: Microsoft YaHei;
  line-height: 32rpx;
  font-weight: 300;
  color: #666666;
}
.text-wrapper {
  padding: 25rpx 0 27rpx;
  flex-shrink: 0;
  align-self: center;
  background-color: #ff7607;
  border-radius: 8rpx;
  width: 230rpx;
  height: 80rpx;
}
.text_2 {
  color: #fefefe;
  font-size: 28rpx;
  font-family: Microsoft YaHei;
  line-height: 28rpx;
}

.section_2 {
  padding: 0 20rpx 51rpx;
  background-color: #ffffff;
}
.group_3 {
  padding: 30rpx 0 19rpx;
  border-bottom: solid 2rpx #f1f1f1;
}
.space-x-7 > view:not(:first-child),
.space-x-7 > text:not(:first-child),
.space-x-7 > image:not(:first-child) {
  margin-left: 7rpx;
}
.image_2 {
  margin: 4rpx 0 3rpx;
  width: 30rpx;
  height: 27rpx;
}
.text_3 {
  color: #555555;
  font-size: 34rpx;
  font-family: Microsoft YaHei;
  line-height: 34rpx;
}
.list-item {
  margin-top: 20rpx;
  padding: 26rpx 19rpx 22rpx;
  border-radius: 10rpx;
  background-image: url('https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/632afc43e391320011695f3b/16639082147025507128.png');
  background-size: 100% 100%;
  background-repeat: no-repeat;
}
.font_2 {
  font-size: 38rpx;
  font-family: Microsoft YaHei;
  line-height: 38rpx;
  color: #333333;
}
.text_4 {
  align-self: flex-start;
}
.font_3 {
  font-size: 28rpx;
  font-family: Microsoft YaHei;
  line-height: 48rpx;
  font-weight: 300;
  color: #666666;
}
.group_4 {
  padding: 0 19rpx;
}
.space-x-34 > view:not(:first-child),
.space-x-34 > text:not(:first-child),
.space-x-34 > image:not(:first-child) {
  margin-left: 34rpx;
}
.text-wrapper_2 {
  flex: 1 1 300rpx;
  padding: 17rpx 0;
  background-color: #ffffff;
  border-radius: 29.5rpx;
  height: 60rpx;
}
.font_4 {
  font-size: 26rpx;
  font-family: Microsoft YaHei;
  line-height: 26rpx;
  color: #5677fc;
}
.section_3 {
  flex: 1 1 300rpx;
  padding: 16rpx 0 15rpx 9rpx;
  background-color: #37c637;
  border-radius: 30rpx;
  height: 60rpx;
}
.image_3 {
  width: 33rpx;
  height: 29rpx;
}
.font_5 {
  font-size: 26rpx;
  font-family: Microsoft YaHei;
  line-height: 21rpx;
  color: #fefefe;
}
.text_5 {
  margin: 4rpx 0 4rpx 14rpx;
}
.list-item_2 {
  margin-top: 20rpx;
  padding: 26rpx 17rpx 22rpx 19rpx;
  border-radius: 10rpx;
  background-image: url('https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/632afc43e391320011695f3b/16639082148003861749.png');
  background-size: 100% 100%;
  background-repeat: no-repeat;
}
.text_6 {
  align-self: flex-start;
}
.list-item_3 {
  margin-top: 22rpx;
  padding: 26rpx 19rpx 23rpx;
  border-radius: 10rpx;
  background-image: url('https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/632afc43e391320011695f3b/16639082148100785937.png');
  background-size: 100% 100%;
  background-repeat: no-repeat;
}
.space-y-20 > view:not(:first-child),
.space-y-20 > text:not(:first-child),
.space-y-20 > image:not(:first-child) {
  margin-top: 20rpx;
}
.text_7 {
  align-self: flex-start;
}
.list-item_4 {
  margin-top: 10rpx;
  padding: 26rpx 17rpx 21rpx 19rpx;
  border-radius: 10rpx;
  background-image: url('https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/632afc43e391320011695f3b/16639082148951363330.png');
  background-size: 100% 100%;
  background-repeat: no-repeat;
}
.space-y-21 > view:not(:first-child),
.space-y-21 > text:not(:first-child),
.space-y-21 > image:not(:first-child) {
  margin-top: 21rpx;
}
.text_8 {
  align-self: flex-start;
}
</style>
